/*******************************************************************************
 * Copyright 2010 MoBrite (A venture of Kinara Systems Private Limited)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.mobrite.domaindroid.common;

import java.util.HashMap;

public class CommonData {

	public static final String TLD_LIST[] = {"com", "org", "net", "in", "cc", "tv", "me", "mobi", "biz", "info"};
	
	public static final HashMap<String, String> WHOIS_SERVER_MAP = createWhoisServerMap();

	public static final HashMap<String, WhoisResponseParser> WHOIS_RESPONSE_PARSER_MAP = createResponseParserMap();
	
	private static HashMap<String, String> createWhoisServerMap() {
		
		HashMap<String, String> table = new HashMap<String, String>();
		table.put("tv", "whois.nic.tv");
		table.put("com", "whois.crsnic.net");
		table.put("org", "whois.publicinterestregistry.net");
		table.put("net", "whois.crsnic.net");
		table.put("edu", "whois.educause.net");
		table.put("cc", "whois.nic.cc");
		table.put("in", "whois.registry.in");
		table.put("biz", "whois.nic.biz");
		table.put("mobi", "whois.dotmobiregistry.net");
		table.put("de", "whois.denic.de");
		table.put("info", "whois.afilias.info");
		table.put("me", "whois.meregistry.net");
		
		return table;
	}

	private static HashMap<String, WhoisResponseParser> createResponseParserMap() {

		WhoisResponseParser defaultWhoisResponseParser = new DefaultWhoisResponseParser();

		HashMap<String, WhoisResponseParser> table = new HashMap<String, WhoisResponseParser>();
		table.put("tv", defaultWhoisResponseParser);
		table.put("com", defaultWhoisResponseParser);
		table.put("org", defaultWhoisResponseParser);
		table.put("net", defaultWhoisResponseParser);
		table.put("edu", defaultWhoisResponseParser);
		table.put("cc", defaultWhoisResponseParser);
		table.put("in", defaultWhoisResponseParser);
		table.put("biz", defaultWhoisResponseParser);
		table.put("mobi", defaultWhoisResponseParser);
		table.put("de", defaultWhoisResponseParser);
		table.put("info", defaultWhoisResponseParser);
		table.put("me", defaultWhoisResponseParser);

		return table;
	}
	
}
